home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GDEVBIT.C < prev    next >
C/C++ Source or Header  |  1991-11-27  |  2KB  |  55 lines

  1. /* Copyright (C) 1991 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gdevbit.c */
  21. /* Fake bitmapped device to estimate rendering time. */
  22. #include "gdevprn.h"
  23.  
  24. /* Define the device parameters. */
  25. #define X_DPI 400
  26. #define Y_DPI 400
  27. #define WIDTH_10THS 80            /* 440 */
  28. #define HEIGHT_10THS 80            /* 1080 */
  29.  
  30. /* The device descriptor */
  31. private dev_proc_print_page(bit_print_page);
  32. gx_device_printer gs_bit_device =
  33.   prn_device(prn_std_procs, "bit",
  34.     WIDTH_10THS, HEIGHT_10THS,
  35.     X_DPI, Y_DPI,
  36.     0,0,0,0,            /* margins */
  37.     1, bit_print_page);
  38.  
  39. /* Send the page to the printer. */
  40. private int
  41. bit_print_page(gx_device_printer *pdev, FILE *prn_stream)
  42. {    /* Just dump the bits on the file. */
  43.     int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
  44.     int lnum;
  45.     byte *in = (byte *)gs_malloc(line_size, 1, "bit_print_page(in)");
  46.     if ( in == 0 ) return -1;
  47.     for ( lnum = 0; lnum < pdev->height; lnum++ )
  48.        {    gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
  49. /******        fwrite(in, 1, line_size, prn_stream);
  50.  ******/
  51.        }
  52.     gs_free(in, line_size, 1, "bit_print_page(in)");
  53.     return 0;
  54. }
  55.